#include <iostream>
#include "All.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

int main(int argc, char* argv[])
{
    int i, j, k;
    int add1, add2;
    double val;
    int dim = 7585;
    int nnz = 50537;
    char dummy;
    int num = 0;

    std::vector<std::vector<double> > A(dim, std::vector<double> (dim, 0));
    std::vector<double> b(dim, 0);

    
    FILE* fin = fopen("data7585A.txt", "r");
    if (fin != NULL)
	    printf("稀疏矩阵数据文件打开成功！！\n");
    else{
	    printf("稀疏矩阵数据文件打开失败，请检查！！\n");  return 0;
    }
    for(i = 0; i < nnz; i++)
    {
        num++;
        fscanf(fin, "%d%c%d%c%lf", &add1, &dummy, &add2, &dummy, &val);
        A[add1 - 1][add2 - 1] = val;
        //std::cout << add1 << " " << add2 << " " << val << std::endl;
    }
    fclose(fin);

    fin = fopen("data7585b.txt", "r");
    if (fin != NULL)
	    printf("右端项数据文件打开成功！！\n");
    else{
	    printf("右端项数据文件打开失败，请检查！！\n");	return 0;
    }
    for(i = 0; i < dim; i++)
    {
	    fscanf(fin, "%c%le", &dummy, &val);
	    b[i] = val;
        //std::cout << val << std::endl;
    }
    fclose(fin);

    Gauss_Elimination_Row(A,b);

    for(i = 0; i < dim; i++)
    {
        std::cout << b[i] << std::endl;
    }





    return 0;
}
